package tests;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import org.junit.*;

import warehouse.Order;
import static org.junit.Assert.*;

/**
 *Order class tests
 *@author Apeiranthitis, Grassos, Moschos
 */
public class OrderTest {

	public OrderTest() {
	}

	/**
	 * Test of init method, of class Order.
	 */
	@Test
	public void testInitCorrect() {
		System.out.println("init");
		Order instance = new Order ("1, A100, 101, 60");
		instance.init();
		assertTrue(!instance.getOrderID().equals("Wrong"));
	}
	@Test
	public void testInitEmptyId() {
		System.out.println("init2");
		Order instance = new Order (" , A100, 101, 60");
		instance.init();
		assertTrue(instance.getOrderID().equals("Wrong"));
	}

	@Test
	public void testInitWrongCustomerId() {
		System.out.println("init3");
		Order instance = new Order ("1, A11111, 101, 60");
		instance.init();
		assertTrue(instance.getOrderID().equals("Wrong"));
	}


	@Test
	public void testInitWrongQuantity() {
		System.out.println("init4");
		Order instance = new Order ("1, A100, 101, 0");
		instance.init();
		assertTrue(instance.getOrderID().equals("Wrong"));
	}
	@Test
	public void testInitNegativeQuantity() {
		System.out.println("init5");
		Order instance = new Order ("4, A100, 101, -1");
		instance.init();
		assertTrue(instance.getOrderID().equals("Wrong"));
	}


	/**
	 * Test of equals method, of class Order.
	 */
	@Test
	public void testEquals() {
		System.out.println("equals");
		Object other = new Order("1, A100, 101, 60");
		Order instance = new Order("1, A102, 102, 80");
		boolean expResult = true;
		boolean result = instance.equals(other);
		assertEquals(expResult, result);
	}


}
